import numpy as np
# class GrabObject:
#     def __init__(self):
#         nu
#         object_list = []
#         pass
#     def result_parse(self):


from d435 import D435
import cv2
from ultralytics import YOLO
if __name__ == '__main__':
    # model_path = r'./yolov8n-seg.pt'
    model_path = r'./best.pt'
    model = YOLO(model_path)
    camera = D435()
    inr = camera.color_intrinsics
    while True:
        camera.update()
        color_image, depth_image = camera.get_images()
        cv2.imshow("detection", color_image)
        aim_cls = 1
        results = model(color_image)
        annotation_frame = results[0].plot()
        for result in results:
            for box in result.boxes:
                for cl in box.cls:
                    print(cl.cpu())
        #
        # out.write(annotation_frame)  # 写入帧
        cv2.imshow("A video", annotation_frame)
        c = cv2.waitKey(30)
        if c == 27:
            break